package dhbw.GUI.Panels;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

import dhbw.Data.Language;
import dhbw.Data.Settings;
import Main.MyController;

public class ContentPanelNavigator extends JPanel{

	private MyController myc;
	protected JComboBox cb_kurs, cb_vorlesung;
	protected JLabel durchschnitt;
	protected JRadioButton radioAll, radioFailed;

	public ContentPanelNavigator(MyController myc) {
		this.myc = myc;
		build();
		
	}

	private void build() {
		this.setBackground(Settings.BG_COLOR);
		CellConstraints cc = new CellConstraints();
		String cols = "6dlu,pref,2dlu,70dlu,6dlu,pref,2dlu,100dlu,40dlu,pref,4dlu,pref,40dlu,pref,6dlu";
		String rows = "0dlu,pref,0dlu";
		FormLayout grid = new FormLayout(cols, rows);
		this.setLayout(grid);

		cb_kurs = new JComboBox();
		cb_vorlesung = new JComboBox();

		durchschnitt = new JLabel();
		durchschnitt.setText("Kurs-Schnitt:    0.0");

		this.add(new JLabel(Language.CLASS[this.myc.getLanguage()]),
				cc.xy(2, 2));
		this.add(cb_kurs, cc.xy(4, 2));
		this.add(new JLabel(Language.COURSE[this.myc.getLanguage()]),
				cc.xy(6, 2));
		this.add(cb_vorlesung, cc.xy(8, 2));
		this.add(durchschnitt, cc.xy(14, 2));
		
		ButtonGroup switchGroup = new ButtonGroup();
		radioAll = new JRadioButton(
				Language.VIEWALLSTUDENTS[this.myc.getLanguage()]);
		radioFailed = new JRadioButton(
				Language.VIEWFAILEDSTUDENTS[this.myc.getLanguage()]);
		switchGroup.add(radioAll);
		switchGroup.add(radioFailed);
		radioAll.setSelected(true);
		radioAll.setBackground(Settings.BG_COLOR);
		radioFailed.setBackground(Settings.BG_COLOR);
		
		this.add(radioAll, cc.xy(10, 2));
		this.add(radioFailed, cc.xy(12, 2));
	}
}